package com.ssmdemo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ssmdemo.entity.Book;
import org.apache.ibatis.annotations.*;

import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface BookMapper{

    @Insert("insert into tbl_book(type,name,description) value(#{book.type},#{book.name},#{book},#{description})")
    public int insert(Book book);

    public List<Book> query(@Param("name") String name,
                            @Param("type") String type,
                            @Param("description") String description);

    @Delete("delete from tbl_book where id=#{id}")
    public int delete(@Param("id") Integer id);

    @Update("update tbl_book set description=#{book.description} where id=#{book.id}")
    public int update(Book book);

}
